package org.game.gobang.client.controller;

import javafx.fxml.FXML;
import javafx.scene.control.Button;
import org.game.gobang.client.constant.ClientConstant;
import org.game.gobang.client.support.CreateRoomBox;
import org.game.gobang.client.support.RoomInit;
import org.game.result.RestResult;
import org.game.result.RestResultBuilder;
import org.game.result.ResultCode;
import org.game.util.JsonUtil;

public class RoomController extends RoomInit {
    @FXML
    public Button createRoom;

    @FXML
    public void refreshAllRoom() {
        RestResult restResult = new RestResultBuilder().success(ResultCode.ALL_ROOMS);
        ClientConstant.ctx.writeAndFlush(JsonUtil.toJson(restResult));
    }

    @FXML
    public void toCreateRoom() {
        new CreateRoomBox("创建房间");
    }
}
